Skip to content

Conversation

@maishivamhoo123
Copy link
Contributor

@maishivamhoo123 maishivamhoo123 commented Dec 22, 2025

BREAKING CHANGE: UpdateRepositoryRulesetClearBypassActor, UpdateRepositoryRulesetClearBypassActor, UpdateRulesetClearBypassActor, and UpdateRulesetNoBypassActor have been removed as they are no longer needed.

Fixes #3859

With the release of Go 1.24, this PR updates the RepositoryRuleset struct to use the omitzero tag. This allows the API to differentiate between a nil slice (do not update) and an empty slice (clear values) without needing separate workaround structs.

Changes

  • Updated RepositoryRuleset.BypassActors to use omitzero instead of omitempty.
  • Removed the now-redundant workaround structs:
    • rulesetNoOmitBypassActors
    • rulesetClearBypassActors
  • Removed the now-redundant workaround functions (the standard UpdateRuleset can now handle clearing actors via an empty slice):
    • UpdateRulesetClearBypassActor
    • UpdateRulesetNoBypassActor

This PR relies on the recent linter updates merged to support the omitzero tag._

@gmlewis gmlewis changed the title feat: Use omitzero for BypassActors to support handling empty arrays feat!: Use omitzero for BypassActors to support handling empty arrays Dec 22, 2025
@codecov
Copy link

codecov bot commented Dec 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.53%. Comparing base (e85e1dc) to head (1493c7d).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3891      +/-   ##
==========================================
- Coverage   92.55%   92.53%   -0.03%     
==========================================
  Files         201      201              
  Lines       14757    14702      -55     
==========================================
- Hits        13659    13604      -55     
  Misses        897      897              
  Partials      201      201              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Dec 22, 2025
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this PR I see a lot of removed code and a single line change.

Please add tests that demonstrate the difference between using omitempty and omitzero for the BypassActors field.

@maishivamhoo123
Copy link
Contributor Author

Thanks for the review! @gmlewis sir I've added test cases for Repositories, Organizations, and Enterprise rulesets to demonstrate the omitzero behavior.

The tests confirm:

Passing nil (zero value) correctly omits the bypass_actors field from the JSON (preserving existing values).

Passing an empty slice [] correctly sends "bypass_actors": [] (clearing the values).

I also ran the linter and tests locally, and everything is green.

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @maishivamhoo123!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo befor emerging.

@gmlewis
Copy link
Collaborator

gmlewis commented Dec 23, 2025

cc: @stevehipwell - @alexandear - @zyfy29

@maishivamhoo123
Copy link
Contributor Author

maishivamhoo123 commented Dec 23, 2025

@alexandear Sir and @gmlewis Sir, I believe I’ve addressed all the comments and resolved the discussion points in this commit. Could you please review and let me know if I’ve missed anything? Thank you Sir.

Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Dec 23, 2025
@gmlewis
Copy link
Collaborator

gmlewis commented Dec 23, 2025

Thank you, @alexandear!
Merging.

@gmlewis gmlewis merged commit 34bb848 into google:master Dec 23, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use omitzero to support handling empty arrays

3 participants